<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <div id="app">
    <button @click="isHappy = !isHappy">{{ isHappy?'开心':'不开心' }}</button>
    <!-- 只需要判断一次的用这个 -->
    <h1 v-if="isHappy">😄</h1>
    <h1 v-else>😔</h1>

    <!-- 频繁切换 -->
    <h1 v-show="isHappy">😄</h1>
    <h1 v-show="!isHappy">😔</h1>
  </div>
  <!-- 引入vue文件 -->
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        isHappy: true,

      },
      methods: {

      }
    })

  </script>
</body>

</html>